package cn.sowfin.dao;

import cn.sowfin.entity.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface UserDao {

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into user(username, password, nickname, add_time) values(#{username}, #{password}, #{nickname}, #{addTime})")
    void insert(User user);

    @Delete("delete from user where id = #{id}")
    void delete(Integer id);

    @Update("update user set nickname = #{nickname} where id = #{id}")
    void update(User user);

    @Select("select * from user")
    List<User> findAll();

    @Select("select * from user where id = #{id}")
    User get(Integer id);
}
